<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<fmt:setBundle basename="ApplicationMessage"/>
<fmt:setLocale value="zh_CN"/>

<div class="modal-dialog ms-modal-dialog" style="width: 550px;">
  <div class="modal-content">

    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <h4 class="modal-title">牵引车、挂车绑定管理</h4>
    </div>

    <form method="POST" action="${ctx.host}/vehicle-sources/bind" class="form-horizontal ms-form" role="form" data-validate="true">

      <div class="modal-body">
      
        <p id="tips" style="display: none; font-size: 12px; color: #3400cc; margin-bottom: 20px; margin-left: 25px;">该牵引车已同步，若非转出车辆，绑定挂车后，请于‘已引入’标签下查看整车信息</p>

        <div class="form-group ms-form-group">
          <label class="control-label col-xs-3 "><span class="color-red">*</span>牵引车 ：</label>
          <div class="col-xs-7 pull-left">
            <select class="select2 form-control" name="tractorId" data-validate="required">
              <option></option>
              <c:forEach var="tractor" items="${tractors}">
                <option value="${tractor.id}" data-code="${tractor.code}">${tractor.brandCNCode}</option>
              </c:forEach>
            </select>
          </div>
        </div>

        <div class="form-group ms-form-group">
          <label class="control-label col-xs-3 ">挂车 ：</label>
          <div class="col-xs-7 pull-left">
	          <select class="select2 form-control" name="trailerId">
	            <option></option>
	            <c:forEach var="trailer" items="${trailers}">
	              <option value="${trailer.id}">${trailer.brandCNCode}</option>
	            </c:forEach>
	          </select>
          </div>
        </div>
        
      </div>

      <div class="modal-footer ms-modal-footer">
        <button type="submit" class="btn ms-btn btn-primary">确定</button>
        <button type="button" class="btn ms-btn ms-btn-gary" data-dismiss="modal">取消</button>
      </div>

    </form>
  </div>
</div>

<script>
  $(document).ready(function() {

    $('select[name="tractorId"]').select2({
      theme: "classic",
      placeholder: '请选择牵引车',
      minimumResultsForSearch: 5,
      allowClear: true
    });
    
	  $('select[name="trailerId"]').select2({
	    theme: "classic",
	    placeholder: '请选择挂车',
	    minimumResultsForSearch: 5,
	    allowClear: true
	  });
  
  });
</script>